package com.shinan.rabbittest.action;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
@Component
public class HelloSender {
    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send(int i, String routingKey) {
        String context = "hello " + routingKey + ":" + i;
        System.out.println("Sender : " + context);
        this.rabbitTemplate.convertAndSend(routingKey, context);
    }
}
